package xian.woniuxy.s_concurrentModificationException;

import java.util.*;

public class App {
    public static void main(String[] args) {
        List<Integer> list = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5));

        ListIterator<Integer> it = list.listIterator();

        while (it.hasNext()) {
            Integer n = it.next();
            list.remove(123);
            System.out.println(n);
        }

        System.out.println(list);

    }
}
